<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr = [
            {
                name:"红楼梦",
                author:"曹雪芹"
            },
            {
                name:"水浒传",
                author:"施耐庵"
            },
            {
                name:"西游记",
                author:"吴承恩"
            },
            {
                name:"三国演义",
                author:"罗贯中"
            },
            {
                name:"水浒传",
                author:"施耐庵"
            },
        ];

        // 自动遍历咱们的数组

        // find 只找数组中第一次出现的数据并返回！
        let obj = arr.find(function(item){
            console.log(item);

            // 如果返回真，就停止往下查找。
            // return item.name === "西游记"

            return item.name === "红楼梦";
        });

        console.log(obj);
    </script>
</body>
</html>